<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
export default {
  name: 'App',
  mounted() {
    const that = this
    window.onresize = () => {
      that.$bus.$emit('onresize')
    }
    window.enterPreventDefault = true
    window.onkeydown = this.handleKeyDown
  },
  beforeDestroy() {
    window.onresize = null
    window.onkeydown = null
  },
  methods: {
    // 按回车键搜索
    handleKeyDown(event) {
      if (event.keyCode === 13 && window.enterPreventDefault) {
        event.preventDefault()
      }
    },
  },
}
</script>
